import './videobutton.scss'
import common from '../BaseComponent/index.js'
class VideoButton extends common { 
    constructor(options) { 
        super(options)
        const defaultOptions = {
            text: '打开"App",查看更多精彩视频',
            color: 'red',
            element: '',
            src: '',
            url:''
        }
        this.options = Object.assign(defaultOptions, options)
        this.$container= this.options.element
        this.initContent()
    }
    initContent() {
        this.$container.addEventListener('click', () => { 
            this.options.callback.call(this)
                this.jump(this.options.url)
        })
        let $img = this.createImg('video-img', this.options.src)
        let $videoButton = this.createDiv('video-evoke')
        let $title = this.createDiv('video-title', this.options.text)
        
        let $icon = this.createDiv('video-icon')
        if (this.options.color == 'red') {
            $videoButton.classList.add('video-button-red')
        }
        else { 
            $videoButton.classList.add('video-button-pink')
        }
        $videoButton.appendChild($title)
        $videoButton.appendChild($icon)
        this.$container.appendChild($img)
        this.$container.appendChild($videoButton)

    }
    
}
export default VideoButton